<?php
import('libs.bdd.AbstractSqlRessource');

/**
 * Description of MySQLRessource
 *
 * @author Gaétan Collaud
 */
class MySQLRessource extends AbstractSqlRessource {

	public function fetch(){
		return mysql_fetch_assoc($this->res);
	}

	public function fetchObject($class=null){
		import('libs.bdd.entity.'.$class);
		return is_null($class) ? mysql_fetch_object($this->res) : mysql_fetch_object($this->res, $class);
	}

	public function noResult(){
		return mysql_num_rows($this->res) == 0;
	}

	public function oneResult(){
		return mysql_num_rows($this->res)>0;
	}

	public function free(){
		return mysql_free_result($this->res);
	}
}
?>
